--
-- Author: shunguo.chen
-- Date: 2016-10-20 15:51:48
--
-- RewardFameVo

local fileName = string.getModeName(...)
local ClassRef = class(fileName)

function ClassRef:ctor(data)
	if data then
		self:init(data)
	end
end

-- "ID"     = 1
-- "cost"   = "98|0|100"
-- "fameid" = "8001"
-- "goods"  = 7999911
-- "image"  = "map102"
-- "mapid"  = 102
-- "achievement"  = 910000021
-- "desc"  = stringid
function ClassRef:init(data)
	for k,v in pairs(data) do
		self[k] = v
	end

	local mapConf = GD:queryMapById(self.mapid) or {}
	self.mapName = L(mapConf.string or self.mapid)

	local fameConf = GD:queryFameById(self.fameid) or {}
	self.fameName = L(fameConf.name or self.fameid)
	local fame = UD.fames[self.fameid]
	self.isOpen = fame and fame:isOpen()

	self.icon = "art/activity_icon/" .. self.image .. ".png"

	local ary = string.split(self.cost, "|")
	self.moneyId = tonumber(ary[1])
	self.moneyIcon = GD:getResIcon(self.moneyId)
	self.moneyCost = tonumber(ary[3])

	self.isComp = UD:isAchievementComplete(self.achievement)
end

function ClassRef:setComp(b)
	self.isComp = b
end

function ClassRef:setOpen(b)
	self.isOpen = b
end

return ClassRef